---------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\sbstjp\OneDrive - Cardiff University\FinalHarvard\ANES20Appendix.log
  log type:  text
 opened on:  12 May 2025, 16:30:31

. 
. use "C:\Users\sbstjp\OneDrive - Cardiff University\anes_timeseries_2020_stata_20220210.dta" // American Natio
> nal Election Study 2020 Time Series Study, Feb 10, 2022 Version. Date accessed: March 09, 2025. Accessed from
>  https://electionstudies.org/data-center/2020-time-series-study/

. 
. // Social justice scale 
. *Delete missing values
. rename V201411x tgpolicy 

. replace tgpolicy = . if tgpolicy == -2
(313 real changes made, 313 to missing)

. rename V201626 offence 

. replace offence = . if inlist(offence, -5, -9)
(176 real changes made, 176 to missing)

. rename V202183 metoo 

. replace metoo = . if inlist(metoo, -9, -7, -6, -5, -4, 998, 999)
(2,122 real changes made, 2,122 to missing)

. rename V202174 blm 

. replace blm = . if inlist(blm, -9, -7, -6, -5, -4, 998, 999)
(936 real changes made, 936 to missing)

. 
. *Reverse code offence so social justice values are high
. egen maxval = max(offence)

. gen roffence = maxval + 1 - offence
(176 missing values generated)

. drop maxval

. 
. *Standardize items in the scale from 1-2 - this avoids 0, for reasons outlined in next step
. foreach var in tgpolicy roffence metoo blm {
  2.     summarize `var'
  3.     gen s`var' = 1 + (`var' - r(min)) / (r(max) - r(min))
  4. }

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
    tgpolicy |      7,967    3.470692    2.007609          1          6
(313 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
    roffence |      8,104    2.429911    1.106463          1          4
(176 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
       metoo |      6,158    59.02891    29.87323          0        100
(2,122 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
         blm |      7,344    53.29562    35.43163          0        100
(936 missing values generated)

. 
. * At this point, the scale has a Cronbach's Alpha of 0.81.
. 
. * Replace missing values with 0 for the specified variables - this is necessary as Stata doesn't add up missi
> ng values and means a 0-1 standardization scale isn't feasible as missing values would overlap with the scale
. foreach var in stgpolicy sroffence smetoo sblm  {
  2.     replace `var' = 0 if missing(`var')
  3. }
(313 real changes made)
(176 real changes made)
(2,122 real changes made)
(936 real changes made)

. 
. * Initialize the total score and the count of non-zero responses
. gen total_scoreSJV = 0

. gen count_nonzeroSJV = 0

. 
. * Add each variable to the total scale score and count it if non-zero
. foreach var in stgpolicy sroffence smetoo sblm  {
  2.     replace total_scoreSJV = total_scoreSJV + `var'
  3.     replace count_nonzeroSJV = count_nonzeroSJV + (`var' != 0)
  4. }
(7,967 real changes made)
(7,967 real changes made)
(8,104 real changes made)
(8,104 real changes made)
(6,158 real changes made)
(6,158 real changes made)
(7,344 real changes made)
(7,344 real changes made)

. 
. * Calculate the average score, avoiding division by zero
. gen SocJusValues = .
(8,280 missing values generated)

. replace SocJusValues = total_scoreSJV / count_nonzeroSJV if count_nonzeroSJV > 0
(8,262 real changes made)

. 
. // Demographic variables
. * Delete missing values
. rename V201507x age 

. replace age = . if age == -9
(348 real changes made, 348 to missing)

. 
. rename V201617x income 

. replace income = . if inlist(income, -9, -5)
(616 real changes made, 616 to missing)

. 
. rename V201600 FemaleGender 

. replace FemaleGender = . if FemaleGender == -9
(67 real changes made, 67 to missing)

. 
. rename V201510 education 

. replace education = . if inlist(education, -9, -8, 95)
(131 real changes made, 131 to missing)

. 
. rename V201549x race

. replace race = . if inlist(race, -9, -8)
(102 real changes made, 102 to missing)

. 
. rename V201200 libconsp 

. replace libconsp = . if inlist(libconsp, -9, -8, 99)
(1,224 real changes made, 1,224 to missing)

. 
. *Create dummy variables
. gen Graduate=.
(8,280 missing values generated)

. replace Graduate=0 if education<6
(4,502 real changes made)

. replace Graduate=1 if inrange(education, 6, 8)
(3,647 real changes made)

. 
. gen BIPOC=. 
(8,280 missing values generated)

. replace BIPOC=0 if race==1
(5,963 real changes made)

. replace BIPOC=1 if inrange(race, 2, 6)
(2,215 real changes made)

. 
. // Standardize variables 
. egen Age = std(age)
(348 missing values generated)

. egen Income = std(income) 
(616 missing values generated)

. 
. // Regression models
. regress SocJusValues Age BIPOC FemaleGender Graduate Income [pweight=V200010b], robust 
(sum of wgt is 6,726.97453522067)

Linear regression                               Number of obs     =      6,688
                                                F(5, 6682)        =      86.62
                                                Prob > F          =     0.0000
                                                R-squared         =     0.0987
                                                Root MSE          =     .26751

------------------------------------------------------------------------------
             |               Robust
SocJusValues | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
         Age |  -.0258102   .0048587    -5.31   0.000    -.0353348   -.0162857
       BIPOC |   .1134197   .0102786    11.03   0.000     .0932703     .133569
FemaleGender |      .0867    .009123     9.50   0.000      .068816     .104584
    Graduate |   .1025213   .0097556    10.51   0.000     .0833971    .1216455
      Income |  -.0037149   .0050006    -0.74   0.458    -.0135178     .006088
       _cons |   1.297448   .0150096    86.44   0.000     1.268025    1.326872
------------------------------------------------------------------------------

. eststo
(est1 stored)

. regress SocJusValues Age BIPOC FemaleGender Graduate Income if libconsp < 4 [pweight=V200010b], robust 
(sum of wgt is 1,846.91042733969)

Linear regression                               Number of obs     =      2,129
                                                F(5, 2123)        =      14.05
                                                Prob > F          =     0.0000
                                                R-squared         =     0.0641
                                                Root MSE          =      .1851

------------------------------------------------------------------------------
             |               Robust
SocJusValues | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
         Age |  -.0185641   .0064748    -2.87   0.004    -.0312617   -.0058666
       BIPOC |  -.0121008   .0136794    -0.88   0.376    -.0389271    .0147256
FemaleGender |    .058287   .0124562     4.68   0.000     .0338594    .0827146
    Graduate |   .0595318   .0144711     4.11   0.000     .0311529    .0879108
      Income |   .0131694   .0077367     1.70   0.089    -.0020028    .0283417
       _cons |    1.61441   .0231727    69.67   0.000     1.568967    1.659854
------------------------------------------------------------------------------

. eststo
(est2 stored)

. esttab

--------------------------------------------
                      (1)             (2)   
             SocJusValues    SocJusValues   
--------------------------------------------
Age               -0.0258***      -0.0186** 
                  (-5.31)         (-2.87)   

BIPOC               0.113***      -0.0121   
                  (11.03)         (-0.88)   

FemaleGender       0.0867***       0.0583***
                   (9.50)          (4.68)   

Graduate            0.103***       0.0595***
                  (10.51)          (4.11)   

Income           -0.00371          0.0132   
                  (-0.74)          (1.70)   

_cons               1.297***        1.614***
                  (86.44)         (69.67)   
--------------------------------------------
N                    6688            2129   
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. 
. log close
      name:  <unnamed>
       log:  C:\Users\sbstjp\OneDrive - Cardiff University\FinalHarvard\ANES20Appendix.log
  log type:  text
 closed on:  12 May 2025, 16:30:32
---------------------------------------------------------------------------------------------------------------
